<template>
  <div class="message-center">
    <div class="brief-title">
      <span>消息中心</span>
      <div class="messsage-info">
        <span></span>
        <span>{{ messageList.length }} 个消息</span>
      </div>
    </div>
    <ul>
      <li v-for="(d, k) in messageList" :key="k">
        <span></span>
        <span @click="toRouterPage(d.url)">{{ d.cn_NAME }}</span>
      </li>
      <!-- <li>
        <span></span>
        <span>放假通知</span>
      </li> -->
    </ul>
  </div>
</template>

<script>
import { toSelectListByID } from "@/api/teacher/admin";

export default {
  name: "message-center",
  data() {
    return {
      messageList: []
    }
  },
  created() {

  },
  mounted() {
    this.loadToPage()
  },
  methods: {
    loadToPage() {
      this.messageList = []
      const data = new Promise((resolve, e) => {
        toSelectListByID().then((r) => {
          const data = r.data
          if (data.code === 200) {
            if (data.data.length) {
              this.messageList = data.data
            }
          }
          console.log('推送信息 成功', r)
        }).catch((e) => {
          console.log('推送信息 错误', e)
        })
      })
      return data
    },
    toRouterPage(url) {
      this.$router.push({
        path: url,
      });
    }
  },
  computed: {},//计算属性
}
</script>

<style scoped>
</style>
